package cj.web.admin.dao;
/*
 *  
 *  
*/
import java.util.List;

import net.paoding.rose.jade.annotation.DAO;
import net.paoding.rose.jade.annotation.SQL;
import net.paoding.rose.jade.annotation.SQLParam;
import cj.web.admin.domain.NewMediaMatrix;

/**
 * 
 * @author 
 *
 */
@DAO
public interface NewMediaMatrixDAO{
	
	@SQL("SELECT id,title,matrixType,category,carouselImage,qrCode,website,deleteFlag,createUser,createAT,updateUser,updateAT,content,iosqrCode FROM NewMediaMatrix WHERE 1=1 AND title=:t.title, AND matrixType=:t.matrixType, AND category=:t.category, AND carouselImage=:t.carouselImage, AND qrCode=:t.qrCode, AND website=:t.website, AND deleteFlag=:t.deleteFlag, AND createUser=:t.createUser, AND createAT=:t.createAT, AND updateUser=:t.updateUser, AND updateAT=:t.updateAT ORDER BY updateAT DESC LIMIT :t.start,:t.end ")
    List<NewMediaMatrix> query(@SQLParam("t") NewMediaMatrix newMediaMatrix);
    
    @SQL("select id,title,matrixType,category,carouselImage,qrCode,website,deleteFlag,createUser,createAT,updateUser,updateAT,content,iosqrCode from NewMediaMatrix where id=:1")
    NewMediaMatrix queryById(int id);
    
    @SQL("INSERT INTO NewMediaMatrix (title,matrixType,category,carouselImage,qrCode,website,deleteFlag,createUser,createAT,updateUser,updateAT,content,iosqrCode) VALUES (:t.title,:t.matrixType,:t.category,:t.carouselImage,:t.qrCode,:t.website,:t.deleteFlag,:t.createUser,:t.createAT,:t.updateUser,:t.updateAT,:t.content,:t.iosqrCode)")
    void create(@SQLParam("t") NewMediaMatrix newMediaMatrix);
	
	@SQL("UPDATE NewMediaMatrix SET title=:t.title,matrixType=:t.matrixType,category=:t.category,carouselImage=:t.carouselImage,qrCode=:t.qrCode,website=:t.website,updateUser=:t.updateUser,updateAT=:t.updateAT,content=:t.content,iosqrCode=:t.iosqrCode WHERE id=:t.id")
    void update(@SQLParam("t") NewMediaMatrix newMediaMatrix);
    
    @SQL("UPDATE NewMediaMatrix SET deleteFlag=0 WHERE id=:1")
    void deleteById(int id);

    @SQL("select id,title,matrixType,category,website from NewMediaMatrix where deleteFlag=1 #if(:t.title!=''){ and title like '%##(:t.title)%' } #if(:t.matrixType!=''){ and matrixType=:t.matrixType }  order by matrixType,updateAT desc limit :t.start,:t.length")
	List<NewMediaMatrix> getList(@SQLParam("t")NewMediaMatrix newMediaMatrix);

    @SQL("select count(1) from NewMediaMatrix where deleteFlag=1 #if(:t.title!=''){ and title like '%##(:t.title)%' } #if(:t.matrixType!=''){ and matrixType=:t.matrixType } ")
	int getSize(@SQLParam("t")NewMediaMatrix newMediaMatrix);
}